﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
using System.Text.RegularExpressions;

namespace HigLabo.Net.WindowsLive
{
    /// <summary>
    /// 
    /// </summary>
    public partial class WindowsLiveClient : OAuth2Client
    {
        public static readonly WindowsLiveClientDefaultSettings Default = new WindowsLiveClientDefaultSettings();
        /// <summary>
        /// 
        /// </summary>
        private static readonly String Callbackkey = "onResult";

        public WindowsLiveClient()
            : this("", "", "")
        {
        }
        public WindowsLiveClient(String clientID, String clientSecret, String redirectUrl)
        {
            this.ClientID = clientID;
            this.ClientSecret = clientSecret;
            this.RedirectUrl = redirectUrl;
            this.AccessToken = new OAuth2AccessToken();
            this.AccessToken.SetProperty(Default.AccessToken);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="container"></param>
        /// <returns></returns>
        public static List<String> CreateJsonTextList(Object container)
        {
            var c = container as JContainer;
            if (c == null) { return new List<string>(); }
            return CreateJsonTextList(c);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="container"></param>
        /// <returns></returns>
        public static List<String> CreateJsonTextList(JContainer container)
        {
            List<String> l = new List<string>();
            if (container != null)
            {
                l.AddRange(container.Select(o => o.ToString()));
            }
            return l;
        }
    }
}

